﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:viewmodel="clr-namespace:DDU.ViewModel;assembly=DDU.ViewModel"
    xmlns:Converters="clr-namespace:DDU.Converters;assembly=DDU.Converters"
    xmlns:UX="clr-namespace:DDU.UX;assembly=DDU.UX"
    x:Class="DDU.Curriculum.Views.UnlockView"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False">

    <phone:PhoneApplicationPage.Resources>
        <Converters:EnumTranslateConverter x:Key="EnumTranslateConverter"/>
    </phone:PhoneApplicationPage.Resources>
    
    
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush Stretch="Fill" ImageSource="/Assets/back.png"/>
        </Grid.Background>
        <Grid.DataContext>
            <viewmodel:UnlockViewModel/>
        </Grid.DataContext>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{StaticResource IDS_APP_NAME}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{StaticResource IDS_PREFERENCE_UNLOCK}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <ScrollViewer>
                <StackPanel>
                    <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                               Text="{StaticResource IDS_PREFERENCE_UNLOCK_MACHINECODE}"/>
                    <TextBlock Style="{StaticResource PhoneTextTitle3Style}" 
                               Foreground="{StaticResource PhoneChromeBrush}"
                               Text="{Binding MachineCode, Mode=OneWay}"/>
                    <toolkit:ListPicker Header="{StaticResource IDS_PREFERENCE_UNLOCK_PAYMENTWAY}" 
                                        ItemsSource="{Binding EnumsUnlockPaymentWay}" 
                                        SelectedItem="{Binding Payway, Mode=TwoWay}">
                        <toolkit:ListPicker.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Converter={StaticResource EnumTranslateConverter}, Mode=OneWay}"/>
                            </DataTemplate>
                        </toolkit:ListPicker.ItemTemplate>
                        <toolkit:ListPicker.FullModeItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Converter={StaticResource EnumTranslateConverter}, Mode=OneWay}" 
                                           Style="{StaticResource PhoneTextTitle2Style}" 
                                           Margin="0,12"/>
                            </DataTemplate>
                        </toolkit:ListPicker.FullModeItemTemplate>
                    </toolkit:ListPicker>
                    <TextBlock Style="{StaticResource PhoneTextSubtleStyle}" 
                               Text="{StaticResource IDS_PREFERENCE_UNLOCK_ORDERNUMBER}"/>
                    <TextBox Text="{Binding OrderNumber, Mode=TwoWay}"/>
                    <Grid Margin="12">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <UX:UXIconTextButton Path="{StaticResource PATH_ICON_UNLOCK}" 
                                             HorizontalAlignment="Center" 
                                             Command="{Binding ResolveCommand}"
                                             Content="{StaticResource IDS_PREFERENCE_UNLOCK_START}"/>

                        <UX:UXIconTextButton Path="{StaticResource PATH_ICON_COPY}" 
                                             HorizontalAlignment="Center" 
                                             Content="{StaticResource IDS_PREFERENCE_UNLOCK_COPY_MACHINECODE}" 
                                             Command="{Binding CopyCommand}"
                                             Grid.Column="1"/>
                    </Grid>
                    
                    
                </StackPanel>
            </ScrollViewer>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>